﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>会员中心中转页面</title>
    <meta name="author" content="PageAdmin CMS" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=0,minimal-ui" />
    <meta name="format-detection" content="telephone=no" />
    <link rel="stylesheet" href="~/Incs/bootstrap/css/bootstrap.min.css">
    <script src="/Js/jquery.min.js" type="text/javascript"></script>
    <script src="/Js/basic.js" type="text/javascript"></script>
    <script src="/Js/UI/ui.js" type="text/javascript"></script>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="refresh" content="10000;url=@ViewBag.MemberUrl" />
    <style>
        body {
            padding: 20px;
            margin: 0px;
            line-height: 30px;
        }
    </style>
</head>
<body>
    <div class="alert alert-info alert-dismissible" role="alert" id="boxAuthorize">
        <a data-dismiss="alert" class="close">×</a>
       在输入框中输入用户名，点击按钮后进入会员中心！
    </div>
    <form class="ui-validForm" method="post"  data-validate-params="tipsStyle:1,beforeSubmit:'OnBeforeSubmit'">
        <div>请填写用户</div>
        <div class="input-group">
            <input type="text" class="form-control" name="username" id="username" placeholder="请输入要进入会员中心的用户名" data-validate="dataType:'*',nullMsg:'请填写用户名!'">
            <span class="input-group-btn">
                <button class="btn btn-primary ui-pagePost" type="button"  data-custom-params="url:'#'">进入会员中心</button>
            </span>
        </div>
        <a href="#" id="memberLink" target="_blank"><span></span></a>
    </form>
    <script type="text/javascript">
        var $memberLink = $("#memberLink ");
        var $username = $("#username");
       function OnBeforeSubmit()
       {
           var username = $username.val().Trim();
           $.ajaxSettings.async = false;
           $.get("@Url.ActionUrl("GetUid")",{username: username}, function (data) {
               var data = JsonParse(data);
               var uid = data.Uid;
               if (uid == 0)
               {
                   Msg("用户名不存在!");
                   $username.focus();
               }
               else
               {
                   $memberLink.attr("href", "@Url.ActionUrl("GoMember")?uid=" + uid);
                   $memberLink.children().trigger("click");
                   CloseDialog();
               }
           })
           return false;
       }
    </script>
</body>
</html>